package com.studyjun.filmsimple;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

/**
 * 对焦框
 * 
 * @author studyjun
 * 
 */
public class CaptureRect extends View {

	private int mcolorfill;
	private float mleft, mtop, mwidth, mheight;

	public CaptureRect(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
	}

	public CaptureRect(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public CaptureRect(Context context) {
		super(context);

	}

	public CaptureRect(Context context, float left, float top, int width,
			int height, int colorfill) {
		super(context);
		// TODO Auto-generated constructor stub
		this.mcolorfill = colorfill;
		this.mleft = left;
		this.mtop = top;
		this.mwidth = width;
		this.mheight = height;
	}
	
	@Override
	  protected void onDraw(Canvas canvas) {
	   // TODO Auto-generated method stub
	   Paint mpaint = new Paint();
	   mpaint.setColor(mcolorfill);
	   mpaint.setStyle(Paint.Style.FILL);
	   mpaint.setStrokeWidth(1.0f);
	   canvas.drawLine(mleft, mtop, mleft+mwidth, mtop, mpaint);
	   canvas.drawLine(mleft+mwidth, mtop, mleft+mwidth, mtop+mheight, mpaint);
	   canvas.drawLine(mleft, mtop, mleft, mtop+mheight, mpaint);
	   canvas.drawLine(mleft, mtop+mheight, mleft+mwidth, mtop+mheight, mpaint);
	   super.onDraw(canvas); 
	  }

}
